package top.kaoshanji.p4ch27a;

import java.util.HashMap;

/**
 * 代码清单-p4ch27a-349页b：加法解析器
 * @author kaoshanji
 * ^_^
 * create time 2025/3/27 19:11
 */
public class AddExpression extends SymbolExpression {

    public AddExpression(Expression left, Expression right) {
        super(left, right);
    }

    // 把左右两个表达式运算的结果加起来
    @Override
    public int interpreter(HashMap<String, Integer> var) {
        return super.left.interpreter(var) + super.right.interpreter(var);
    }

}
